home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #2 / Amiga Plus CD - 2004 - No. 02.iso / AmigaPlus / Tools / Development / RxMUI / Examples / DragNDrop.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  2004-01-31  |  4.3 KB  |  147 lines

  1. /* How to handle different types of Drag and Drop between Lists */
  2.  
  3. signal on halt
  4. signal on break_c
  5.  
  6. call Init
  7. call CreateApp
  8. call HandleApp
  9.  
  10. /***********************************************************************/
  11. Init: procedure
  12.     l="rmh.library";if ~show("L",l) then;if ~addlib(l,0,-30) then exit
  13.     if AddLibrary("rexxsupport.library","rxmui.library")~=0 then exit
  14.     call RxMUIOpt("DebugMode ShowErr")
  15.     return
  16. /***********************************************************************/
  17. CreateApp: procedure
  18.  
  19.     strip.0="mproject"
  20.      mproject.Title="Project"
  21.      mproject.class="menu"
  22.       mproject.0=menuitem("mabout","About...","?")
  23.       mproject.1=menuitem("maboutrxmui","About RxMUI...")
  24.       mproject.2=menuitem("maboutmui","About MUI...")
  25.       mproject.3=menuitem("","BAR")
  26.       mproject.4=menuitem("mhide","Hide","H")
  27.       mproject.5=menuitem("","BAR")
  28.       mproject.6=menuitem("mquit","Quit","Q")
  29.     res=NewObj("menustrip","strip")
  30.     if res~=0 then exit
  31.  
  32.     app.Title="DragnDrop"
  33.     app.Version="$VER: DragnDrop 1.0 (17.12.00)"
  34.     app.Copyright="©1999, alfie"
  35.     app.Author="alfie"
  36.     app.Description="DragnDrop example"
  37.     app.Base="EXAMPLE"
  38.     app.menustrip="strip"
  39.     app.SubWindow="win"
  40.      win.ID="MAIN"
  41.      win.Title="DragnDrop"
  42.      win.contents="mgroup"
  43.  
  44.       mgroup.0="cg0"
  45.        cg0.class="group"
  46.        cg0.columns=2
  47.  
  48.         cg0.0=Text(,ParseText("%cAvailable Fields\n(alpha sorted)"),"none","none")
  49.  
  50.         cg0.1=Text(,ParseText("%cVisible Fields\n(sortable)"),"none","none")
  51.  
  52.         cg0.2="lv1"
  53.          lv1.Class="Listview"
  54.          lv1.DragType="Immediate"
  55.          lv1.ControlChar="1"
  56.          lv1.list="list1"
  57.           list1.Frame="InputList"
  58.           list1.ShowDropMark=0
  59.           list1.DragSortable=1
  60.            list1.0="Age"
  61.            list1.1="Birthday"
  62.            list1.2="c/o"
  63.            list1.3="City"
  64.            list1.4="Comment"
  65.            list1.5="Country"
  66.            list1.6="EMail"
  67.            list1.7="Fax"
  68.            list1.8="First name"
  69.            list1.9="Job"
  70.            list1.10="Name"
  71.            list1.11="Phone"
  72.            list1.12="Projects"
  73.            list1.13="Salutation"
  74.            list1.14="ZIP"
  75.            list1.15="State"
  76.            list1.16="Street"
  77.  
  78.         cg0.3="lv2"
  79.          lv2.Class="Listview"
  80.          lv2.DragType="Immediate"
  81.          lv2.list="list2"
  82.           list2.Frame="InputList"
  83.           list2.DragSortable=1
  84.  
  85.         cg0.4=Text(,ParseText("%cListview without\nmultiple selection."))
  86.  
  87.         cg0.5=Text(,ParseText("%cListview with\nmultiple selection."))
  88.  
  89.         cg0.6="lv3"
  90.          lv3.Class="Listview"
  91.          lv3.DragType="Immediate"
  92.          lv3.Dropable=0
  93.          lv3.ControlChar=1
  94.          lv3.list="list3"
  95.           list3.Frame="InputList"
  96.           list3.DragSortable=1
  97.           list3.list="ll"
  98.            do i=0 to 49
  99.                ll.i="Line "i
  100.            end
  101.  
  102.         cg0.7="lv4"
  103.          lv4.Class="Listview"
  104.          lv4.DragType="Immediate"
  105.          lv4.list="list4"
  106.          lv4.MultiSelect="Default"
  107.           list4.Frame="InputList"
  108.           list4.DragSortable=1
  109.           list4.list="ll"
  110.  
  111.     res=NewObj("application","app")
  112.     if res~=0 then exit
  113.  
  114.     call DandD("list1","list1","noself")
  115.     call DandD("list1","list2","auto remove")
  116.     call DandD("list2","list1","auto remove sorted")
  117.  
  118.     call Notify("WIN","CLOSEREQUEST",1,"APP","RETURNID","QUIT")
  119.     call Notify("mabout","menutrigger","everytime","app","about","win")
  120.     call Notify("maboutrxmui","menutrigger","everytime","app","aboutrxmui","win")
  121.     call Notify("maboutmui","menutrigger","everytime","app","aboutmui","win")
  122.     call Notify("mhide","menutrigger","everytime","app","set","iconified",1)
  123.     call Notify("mquit","menutrigger","everytime","app","returnid","quit")
  124.  
  125.     call set("win","open",1)
  126.  
  127.     return
  128. /**************************************************************************/
  129. handleApp: procedure
  130.     hggg=1
  131.     ctrl_c=2**12
  132.     do forever
  133.         call newhandle("APP","H",ctrl_c)
  134.         if and(h.signals,ctrl_c)>0 then exit
  135.         select
  136.             when h.event="QUIT" then exit
  137.             when h.event="DROPEVENT" then call dropFun(h.from,h.to)
  138.             otherwise say h.event
  139.         end
  140.     end
  141. /***********************************************************************/
  142. halt:
  143. break_c:
  144.     exit
  145. /**************************************************************************/
  146.  
  147.